perm filename DEMO.AAA[RDG,DBL] blob
sn#534517 filedate 1980-09-14 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00032 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00004 00002 Starting the system
C00010 00003 What was created?
C00012 00004 Looking around
C00014 00005 Creating a new class
C00018 00006 Creating a new typical example, for a class
C00024 00007 Slot verification by EDITU
C00030 00008 Examining unit which represent Formats
C00032 00009 Adding on a new person
C00035 00010 Creating a new entity - HisMother
C00037 00011 How are new units created?
C00040 00012 Hack to LISP's evaluator
C00041 00013 Creating a new datatype - GenderType
C00044 00014 Engendering our visitor
C00049 00015 Indicating that Mothers are female
C00053 00016 Add another person
C00055 00017 Can a male be a mother?
C00056 00018 Now make Husbands male:
C00058 00019 To give HisMother a Husband
C00060 00020 Create a new type of slot - Father
C00062 00021 There is a unit for Composition:
C00072 00022 Examples of SlotCombiners
C00073 00023 What else can we say about Father?
C00074 00024 Far too quite:
C00075 00025 How do accessing functions really work?
C00078 00026 The FindDefault function:
C00081 00027 Strategy:
C00082 00028 What gets done when? - system dependent fns
C00088 00029 Creating a new function
C00090 00030 New class of types of slots - ChattySlots
C00093 00031 Create a new typical member of AnyChattySlot
C00096 00032 Conclusion
C00097 ENDMK
C⊗;
Starting the system
[I adviced USERNAME to return "NewUser" for this.]
@<CSD.IA>DEMO.EXE
Shall I start the RLL system now? yes
*** Am opening Dribble file: TRACE.Aug18 [18-Aug-80 13:38:45]
Reading in RLL.STATUS now.
Opening knowledge base <CSD.RLL>RLL.KB.12
Opening paging file <CSD.IA>RLL.PAGE.1
Loading unit RLL.UNITINDEX
Loading unit RLL.STATUS
Last written by (CSD.GREINER 16-Aug-80 22:18:15)
{{Loading unit KBsFNS
Loading unit AllIsas
Loading unit ToGetValue
Loading unit OrderedPrototypes
Loading unit Defn
Loading unit Prototypes
Loading unit MySlotsNowOrdered
Loading unit TypicalPrimSlot
Loading unit TypicalSlot
Loading unit BeforeGetValue
Loading unit AfterGetValue
Loading unit KBsVARS
Loading unit KBsConnectedTo}}
This kb, RLL is already connected to all of (RLL).
Do you wish to read in any Knowledge Bases? yes
{{Loading unit AllExamples
Loading unit AnyUser
Loading unit UserNames
Loading unit RussGreiner
Loading unit DougLenat
Loading unit LarryHines
Loading unit AndyFreeman}}
I don't know who you are!
Shall I create a unit to store information about you? yes
Is NewUser an appropriate name? no
What name would you prefer? Visitor
{{Loading unit GetPossibleSlotsFn
Loading unit IExamples
Loading unit LispFn
Loading unit TypicalVirtualSlot
Loading unit PossibleSlotsOfIExamples
Loading unit StoredAList
Loading unit GenlsModels
Loading unit SuperClass*
Loading unit TypicalExample
Loading unit Anything
Loading unit AnyCT&U
Loading unit NewPossibleSlots
Loading unit TypicalCT&U
Loading unit MyCreator
Loading unit MyTimeOfCreation
Loading unit MyToKillMe
Loading unit TypicalAccessSlot
Loading unit MyToRenameMe
Loading unit MyEssentialVirtualSlots
Loading unit MySensibleSlots
Loading unit MyCreatedAs
Loading unit MySlots
Loading unit TypicalThing
Loading unit Specializations
Loading unit TypicalUnitFn
Loading unit TypicalStorableFn
Loading unit TypicalFunction
Loading unit TypicalProcess
Loading unit Isa
Loading unit AllGenls
Loading unit AllSpecs
Loading unit Characteristics
Loading unit Descr
Loading unit TypicalUser
Loading unit InformalName
Loading unit UsualKBs
Loading unit WritingOptions
Loading unit OpenningOptions
Loading unit OrderForToInit
Loading unit Typical$SELF$Slot
Loading unit ToAddValue
Loading unit BeforePutValue
Loading unit VerifyElement
Loading unit Format
Loading unit FnForPutting
Loading unit FSet
Loading unit SuperTypEx*
Loading unit TypicalExampleOf
Loading unit SuperClass
Loading unit FnForAdding
Loading unit ToCache
Loading unit ToPutValue
Loading unit AfterPutValue
Loading unit Inverse
Loading unit KBUpdates
Loading unit Examples
Loading unit AllTypicalExampleOfs}}
1 -- RESOL
2 -- GENLINFO
3 -- BIOLOGY
4 -- SETS
5 -- MATH
6 -- NUMBER
7 -- HOBBIT
8 -- HEURS
9 -- OLD
10 -- EURISKO
Enter the numbers of the ones you wish to use: 2
{{Loading unit FunctionSpec
Loading unit HighLevelDefn
Loading unit DomainType
Loading unit FList}}
Opening knowledge base <CSD.RLL>GENLINFO.KB.4
Opening paging file <CSD.IA>GENLINFO.PAGE.1
{{Loading unit GENLINFO.UNITINDEX
Loading unit GENLINFO.STATUS}}
Last written by (CSD.HINES 31-Jul-80 15:38:24)
Network RLL already open.
This kb, GENLINFO is already connected to all of (GENLINFO RLL).
KBs loaded.
(<CSD.IA>DEMO.EXE.3 . <LISP>LISP.EXE.133)
What was created?
{ Turn off those obnoxious Loading, ... messages
}
99←(SETQ UP.TRACEFILE NIL]
(UP.TRACEFILE reset)
NIL
{ Now look at what was just created
}
100←EDITU(Visitor]
edit
98*pp
(Isa (AnyUser)
UserNames ("NewUser")
AllIsas (AnyCT&U Anything AnyUser)
Prototypes (TypicalUser TypicalCT&U TypicalThing)
MySlotsNowOrdered (OrderedPrototypes)
{ NOTE: Slots beginning with "My" are syntactic.}
UsualKBs (RLL)
MyCreatedAs (IExamples (AnyUser))
MyTimeOfCreation "18-Aug-80 13:40:23"
MyCreator "NewUser"
OpenningOptions NoEntries
MySensibleSlots (Descr Characteristics Prototypes AllSpecs AllGenls AllIsas Isa
OrderedPrototypes Specializations MySlots MyCreatedAs
MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots
MyToRenameMe MyToKillMe MyTimeOfCreation MyCreator UserNames
OpenningOptions WritingOptions UsualKBs InformalName))
{ Happy?
}
98*ok
Nothing changed.
Visitor
Looking around
{ Let's see the top level units:
}
1←DI(Anything S 2]
Note the trace flag has been turned off.
Anything
AnyAT&U
AnyAbstractThing
AnyCT&U
AnyConcreteThing
AnyUnit
!DONE!
{ This showed the subclasses of Anything, down (a total of) two levels
The ...&U units are hacks, to store both the unit and its meta-unit
in the same physical unit.
More interesting is:
}
2←DI(AnyCT&U S 2]
Note the trace flag has been turned off.
AnyCT&U
AnyClassOfObjects
AnyDatatype
AnyDecomposableObject
AnyFormat
AnyInheritance
AnyIntensionalObject
AnyOverhead
AnyProcess
AnyUnit
AnyUser
!DONE!
Creating a new class
{ Let us create a new unit - which refers to people:
}
4←NewSpec(AnyPerson]
Is a ISubClass of: AnyCT&U
Please enter the Knowledge Base in which to store AnyPerson: GENLINFO
Is the format of (LAMBDA (units sl? oth?) (MapUnion (IsOk units)
(FUNCTION (LAMBDA (x) (GetValue x (QUOTE Prototypes) (AddOnCharacter
oth? (QUOTE VERYSAFESLOT))))))) a list?
yes
{ Here, RLL is asking about the Format of the expression (LAMBDA ...).
This was because it didn't know about the function "MapUnion".
It will, later in RLL's development.
}
You are about to write on an external file.
Do you want to enter ReadOnly mode? no
{ Before the first write, RLL gives the user a chance to leave
the systems unmodified. Here, we told RLL to go ahead.
}
* Initialized AnyPerson *
edit
99*p
(Isa (AnyClassOfObjects)
AllIsas (AnyCT&U Anything AnyClassOfObjects)
Prototypes (TypicalClass TypicalCT&U TypicalThing)
MySlotsNowOrdered (OrderedPrototypes)
MyCreatedAs (ISubClass &)
MyTimeOfCreation "18-Aug-80 13:50:28"
MyCreator "NewUser"
TotalSoFar 0
SuperClass (AnyCT&U)
MySensibleSlots (Descr Characteristics Prototypes AllSpecs AllGenls
AllIsas Isa OrderedPrototypes Specializations MySlots MyCreatedAs
MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots MyToRenameMe
MyToKillMe MyTimeOfCreation MyCreator TotalSoFar --))
99*-1 pp
(Descr Characteristics Prototypes AllSpecs AllGenls AllIsas Isa
OrderedPrototypes Specializations MySlots MyCreatedAs MySensibleSlots
MySlotsNowOrdered MyEssentialVirtualSlots MyToRenameMe MyToKillMe
MyTimeOfCreation MyCreator TotalSoFar TypicalExample AllExamples
Examples SubClass* SuperClass* SubClass SuperClass GenlsModels
StdExamples IntensionalExamples RangeOf DomainOf)
{ ↑ These are slots which are well defined for this unit.
}
*** Am re-opening Dribble file: TRACE.Aug18 [18-Aug-80 13:53:01]
{ ↑ A dribble file records the session. (You're looking at it now.]
{ This class unit looks
}
100*ok
Verifying slots
AnyPerson
Creating a new typical example, for a class
{ Now we'll create a unit which hold facts typically true of any person.
(That is, default values; as well as a list of new slots to be inherited
by every new person.]
}
5←NewTypEx]
Name: TypicalPerson
Is a ITypEx of: AnyPerson
Please enter the Knowledge Base in which to store TypicalPerson: GENLINFO
Is the format of (LAMBDA (units sl? oth?) (MapUnion (IsOk units) (FUNCTION (LAMBDA
(uNITcomp sLOTcomp oTHERcomp) (OR (MapUnion (GetValue uNITcomp (QUOTE GenlsModels)
(AddOnCharacter oTHERcomp (QUOTE VERYSAFESLOT)))
(LAMBDA (x) (GetValue x (QUOTE Prototypes) (AddOnCharacter oTHERcomp
(QUOTE VERYSAFESLOT)))))) NoEntries)))))
a list?
yes
{ No, RLL still doesn't know about MapUnion.
}
Shall I create a slot with the high level defn:
(Composition TypicalExample SubClass*)? no
{ To update inverse links, it has to "invert" each relevant slot.
For this it uses that slot's high level definition... which goes to
the slot combiners involved, ...
Above it was inverting GenlsModels, whose HighLevelDefn was
(Composition SuperClass* TypicalExampleOf]
RLL was asking whether to preserve this definition as or slot, or not.
I said NO.
}
* Initialized TypicalPerson *
edit
1*p
(Isa (AnyArchetype) TypicalExampleOf AnyPerson NewPossibleSlots NoEntries
AllIsas (AnyIntensionalObject AnyCT&U Anything AnyAT&U AnyArchetype) Prototypes
(TypicalTypicalEx TypicalCT&U TypicalAT&U TypicalThing) MySlotsNowOrdered (
OrderedPrototypes) MyCreatedAs (ITypEx &) MyTimeOfCreation "18-Aug-80 13:59:43"
MyCreator "NewUser" MySensibleSlots (Descr Characteristics Prototypes AllSpecs
AllGenls AllIsas Isa OrderedPrototypes Specializations MySlots MyCreatedAs
MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots MyToRenameMe
MyToKillMe MyTimeOfCreation MyCreator SubTypEx* --))
1*-1 pp
(Descr Characteristics Prototypes AllSpecs AllGenls AllIsas Isa
OrderedPrototypes Specializations MySlots MyCreatedAs MySensibleSlots
MySlotsNowOrdered MyEssentialVirtualSlots MyToRenameMe MyToKillMe
MyTimeOfCreation MyCreator SubTypEx* SuperTypEx* SubTypEx SuperTypEx
TypicalExampleOf NewPossibleSlots PossibleSlots)
{ ↑ These slots are pertanent to all prototypes, such as this TypicalPerson.
RLL determined these using from the prototypical prototype, TypicalTypicalEx.
}
2*↑ 5 p
NewPossibleSlots
{ ↑ Its value lists the new slots, which all people will have.
}
4*nx p
NoEntries
{ Currently it is empty
(Note we use "NoEntries" to indicate a list we know is empty,
leaving NIL to mean a value we simply don't know.]
}
5*: (Mother Husband]
{ Now new examples of AnyPerson will have these two slot.
}
6*p
... (Mother Husband) AllIsas (AnyIntensionalObject AnyCT&U Anything AnyAT&U
AnyArchetype) Prototypes (TypicalTypicalEx TypicalCT&U TypicalAT&U TypicalThing)
MySlotsNowOrdered (OrderedPrototypes) MyCreatedAs (ITypEx &) MyTimeOfCreation
"18-Aug-80 13:59:43" MyCreator "NewUser" MySensibleSlots (Descr Characteristics
Prototypes AllSpecs AllGenls AllIsas Isa OrderedPrototypes Specializations
MySlots MyCreatedAs MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots
MyToRenameMe MyToKillMe MyTimeOfCreation MyCreator SubTypEx* --))
6*(-2 Mother NoEntry Husband NoEntry]
{ (NoEntry is like NoEntries in purpose. It, however,
refers to the absense of a single entry.]
Here, it is used to indicate that TypicalPerson cannot
provide any sort of default information about a new unit's relatives.
{ It also causes RLL to consider creating a Mother (resp. Husband)
type of slot, thusly
}
7*ok
Slot verification by EDITU
Verifying slots
Your attempted slot name Mother is NOT even a unit. Should it be? yes
{ This will create a new unit, to house facts about the "Mother" slot.}
What should the Isa link for this Mother link be?
{ It will be created as a new Primitive slot - hence the "P" response above.}
Expecting one of:
] -- return NIL
; -- followed by a comment
P
V
A
*
What should the Isa link for this Mother link be? P
Please enter the Knowledge Base in which to store Mother: GENLINFO
* Initialized Mother *
edit
8*pp
(Isa (PrimSlot)
AllIsas
(AnySlot AnyUnitListFn AnyFunction AnyCT&U Anything AnyProcess
AnyStorableFn AnyUnitFunction PrimSlot)
Prototypes
(TypicalPrimSlot TypicalSlot TypicalUnitFn TypicalStorableFn
TypicalFunction TypicalProcess TypicalCT&U TypicalThing)
MySlotsNowOrdered
(OrderedPrototypes)
MyCreatedAs
(IExamples (PrimSlot))
MyTimeOfCreation "18-Aug-80 14:10:56" MyCreator "NewUser" Format
(*Do* FOneOf FSingleton FSet FList FOrderedSet FBag)
Datatype
(NonNILType)
OrderForToInit 20 MySensibleSlots
(Descr Characteristics Prototypes AllSpecs AllGenls AllIsas Isa
OrderedPrototypes Specializations MySlots MyCreatedAs
MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots
MyToRenameMe MyToKillMe MyTimeOfCreation MyCreator WhatToProcess
HowToProcess LispFn IUseDefnOf IUseCVOf DefnUsedBy CVUsedBy
FunctionCharacter RangeType DomainType PreConditions Range Domain
Definition FunctionSpec Format Datatype DataRange Defn
HighLevelDefn IsBuiltFrom UsingFunctions SlotsBuiltFrom
UsingFunctionals UnitsBuiltFrom SlotsUsedInBuilding ToLookUp
ToCache LispFnForStoredFn StoredAList ToConfirmValue
UsingSlotCombiners ToGetValue HandDoneSBF AllSBF VerifyElement
VerifyAll ToSubstValue ToDeleteValue ToAddValue MakesSenseFor
SubSlot* SuperSlot* SubSlot SuperSlot ToInitialize ToPutValue
OrderForToInit KBUpdates Inverse IsEssentialFor))
8*f Datatype
9*p
... Datatype (NonNILType) OrderForToInit 20 MySensibleSlots (Descr
Characteristics Prototypes AllSpecs AllGenls AllIsas Isa OrderedPrototypes
Specializations MySlots MyCreatedAs MySensibleSlots MySlotsNowOrdered
MyEssentialVirtualSlots MyToRenameMe MyToKillMe MyTimeOfCreation MyCreator
WhatToProcess --))
9*(2 (UnitType) DataRange (*P AnyPerson]
{ This "UnitType" indicates the value of U:Mother will be a unit;
and the datarange restricts that, to say that unit will descend from AnyPerson}
10*↑ f Format
12*2 p
(*Do* FOneOf FSingleton FSet FList FOrderedSet FBag)
{ IE The format must be one of these
We'll see soon that each of these formats is really a unit.}
13*xtr 3
{ This means U:Mother will be filled with a single entry.
That's all I want to say about Mothers, at this time.}
14*ok
Verifying slots
Your attempted slot name Husband is NOT even a unit. Should it be? yes
What should the Isa link for this Husband link be? P
Please enter the Knowledge Base in which to store Husband: GENLINFO
* Initialized Husband *
edit
{ To fix Husband's range specification:}
15*f Datatype
16*2 p
(NonNILType)
17*: (UnitType) DataRange (*P AnyPerson]
18*ok
Verifying slots
What should the value of Husband:Format be?
Expecting one of:
] -- return NIL
; -- followed by a comment
FSingleton
FSet
FList
FOrderedSet
FBag
What should the value of Husband:Format be? FSingleton
TypicalPerson
{ Note it asked for Husband's format, as I hadn't specified it; and RLL
figured it would be needed eventually.}
Examining unit which represent Formats
{ Note first that there are two subclasses of formats:}
30←SubClass(AnyFormat]
(AnySlotFormat AnyValueFormat)
{ The interesting one is}
31←Examples(AnySlotFormat]
(FSingleton FList FSet FOrderedSet FBag FListN)
{ Each of these is a bonafide unit:}
32←EDITU(FSet]
edit
66*p
(Isa (AnySlotFormat)
FnForVerifyingAll (LAMBDA & &)
FnForVerifyingElement (LAMBDA & &)
FormatCharacter (MayBeEmpty NonOrdered NoDuplicated ArbitraryNumberOfEntries)
FnForAdding (LAMBDA & &)
FnForDeleting (LAMBDA & & &)
FnForSubstituting (LAMBDA & & &)
FnForPutting (LAMBDA & &) --)
66*ok
Nothing changed.
FSet
36←(MAPCAR (Examples 'AnySlotFormat) 'FormatCharacter]
((MayBeEmpty SingleEntry)
(MayBeEmpty Ordered Duplicates ArbitraryNumberOfEntries)
(MayBeEmpty NonOrdered NoDuplicated ArbitraryNumberOfEntries)
(MayBeEmpty Ordered NoDuplicated ArbitraryNumberOfEntries)
(MayBeEmpty NonOrdered Duplicates ArbitraryNumberOfEntries)
(MayBeEmpty Ordered Duplicates ExactNumberOfEntries))
Adding on a new person
{ Back to our main plot:
Let's make Visitor think of itself as a person.
}
6←EDITU(Visitor]
edit
19*p
(Isa (AnyUser) UserNames ("NewUser") AllIsas (AnyCT&U Anything AnyUser)
Prototypes (TypicalUser TypicalCT&U TypicalThing) MySlotsNowOrdered (
OrderedPrototypes) UsualKBs (RLL) MyCreatedAs (IExamples &) MyTimeOfCreation
"18-Aug-80 13:40:23" MyCreator "NewUser" MySensibleSlots (Descr Characteristics
Prototypes AllSpecs AllGenls AllIsas Isa OrderedPrototypes Specializations
MySlots MyCreatedAs MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots
MyToRenameMe MyToKillMe MyTimeOfCreation MyCreator UserNames --) --)
19*2 (n AnyPerson]
21*0 p
(Isa (AnyUser AnyPerson) UserNames ("NewUser") AllIsas (AnyCT&U Anything AnyUser)
{{ Prototypes (TypicalUser TypicalCT&U TypicalThing) MySlotsNowOrdered (
OrderedPrototypes) UsualKBs (RLL) MyCreatedAs (IExamples &) MyTimeOfCreation
"18-Aug-80 13:40:23" MyCreator "NewUser" MySensibleSlots (Descr Characteristics
Prototypes AllSpecs AllGenls AllIsas Isa OrderedPrototypes Specializations
MySlots MyCreatedAs MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots
MyToRenameMe MyToKillMe MyTimeOfCreation MyCreator UserNames --) --)}}
22*ok
Verifying slots
Visitor
{ Note I could have made AnyUser a subclass of AnyPerson,
but who knows who (or what) will eventually be using RLL...
}
7←EDITU]
=Visitor
edit
{ Let's give our visitor a mother:
(n Mother HisMother]
(Note this should NOT work, as we have yet to define "HisMother"...]}
28*ok
Verifying slots
Trouble doing actual Put (Visitor Mother HisMother)
Shall I go on, break, or try again? G
Visitor
Creating a new entity - HisMother
{ So let's create that unit.}
8←NewIsa)
Name: HisMother
Is a IExamples of: AnyPerson
Please enter the Knowledge Base in which to store HisMother: GENLINFO
* Initialized HisMother *
edit
29*pp
(Isa (AnyPerson)
AllIsas (AnyCT&U Anything AnyPerson)
Prototypes (TypicalPerson TypicalCT&U TypicalThing)
MySlotsNowOrdered (OrderedPrototypes)
MyCreatedAs (IExamples (AnyPerson))
MyTimeOfCreation "18-Aug-80 14:27:04"
MyCreator "NewUser"
MySensibleSlots (Descr Characteristics Prototypes AllSpecs AllGenls AllIsas Isa
OrderedPrototypes Specializations MySlots MyCreatedAs
MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots
MyToRenameMe MyToKillMe MyTimeOfCreation MyCreator Husband Mother))
29*ok
Verifying slots
HisMother
How are new units created?
37←PP(NewIsa]
loading from <CSD.RLL>UTIL..7
(NewIsa
[LAMBDA (Son Parent whichKB) **COMMENT** **COMMENT**
(NewUnit Son Parent (QUOTE IExamples)
whichKB T])
(NewIsa)
{ So what is "IExamples"
}
38←EDITU(IExamples]
edit
69*p
(Isa (AnyInheritance)
Descr (Here is a typical example of how inheritance works.)
UseToGetSlots GenlsModels
GetPossibleSlotsFn PossibleSlotsOfIExamples)
69*ok
Nothing changed.
IExamples
{ Are there other inheritances?
}
39←AllExamples(AnyInheritance]
(ITypEx ISubClass IExamples)
{ What is that PossibleSlotsOfIExamples?
}
39←EDITU(PossibleSlotsOfIExamples]
edit
70*p
(UsedByInheritance IExamples
Isa (AnySlotGetter)
Format FOrderedSet
HighLevelDefn (PutInOrder (CommonXProd NewPossibleSlots (ApplyToEach MapUnion
GenlsModels)
WhereInitFn)
OrderForToInit CAR NIL)
Datatype (NonNILType)
{{ MyCreatedAs (IExamples &) RangeType (FOrderedSet &) AllIsas (
AnyUnitListFn AnyFunction AnyCT&U Anything AnyProcess AnyStorableFn
AnySlotGetter) Prototypes (TypicalSlotGetter TypicalStorableFn
TypicalFunction TypicalProcess TypicalCT&U TypicalThing)
MySlotsNowOrdered (OrderedPrototypes) --)}}
{ Wow - look at that HighLevelDefn!
}
72*ok
Nothing changed.
PossibleSlotsOfIExamples
Hack to LISP's evaluator
{ So lets see our collection of people:
}
9←Examples(AnyPerson]
(HisMother Visitor)
{ 1) That is, as U:Isa was filled with AnyPerson,
U was added to AnyPerson:Examples
2) Note there is no function named "Examples".
That call worked because we've hacked up LISP's evaluator to try
(GetValue U 'S) if S(U) fails
}
10←GETD(Examples]
NIL
{ It is, of course, a unit:}
11←Unitp(Examples]
RLL
Creating a new datatype - GenderType
{ Lets now create a new datatype, to help us distinguish
Males from Females
First, what are the current datatypes?
}
11←Examples(AnyDatatype]
(KBType TVType NonNILType GrammarType NumberType BooleanType UnrestrictedType
FunctionType SlotType IntegerType UnitType StringType)
{ We'll create a copy of BooleanType, then modify that copy
using the function
}
12←NU(GenderType)
Copy from: BooleanType
Please enter the Knowledge Base in which to store GenderType: GENLINFO
edit
30*pp
(VerifyType [LAMBDA (x)
(FMEMB x (QUOTE (T F]
GenerateAll
[LAMBDA NIL
(LIST T (QUOTE F]
Isa
(AnyDatatype)
IsTypeOf NoEntries SuperDT (NonNILType)
MyCreatedAs
(IExamples (AnyDatatype)))
{ Apparently the function stored in VerifyType returns nonNIL if its argument
qualifies as a member of this datatype. (We could have found this out
by looking on the "VerifyType" unit...
and GenerateAll returns a list of these acceptable values.
}
30*2 3 3 2 2 p
(T F)
32*: (Male Female Neuter Hermaphroditic]
34*!nx p
GenerateAll
36*nx p
(LAMBDA NIL (LIST T &))
{{37*-1 p
(LIST T (QUOTE F))
38*redo 32
39*p
... (Male Female Neuter Hermaphroditic))
39*mbd (APPEND (QUOTE *]}}
42*0 pp
[LAMBDA NIL
(APPEND (QUOTE (Male Female Neuter Hermaphroditic]
{ Everything else looks right. so}
42*ok
Verifying slots
GenderType
{ Note another way of doing this would be to create a new class, AnyGender
and have a unit for each of these - Male, Female, ...
This was how Formats, and Datatypes (and inheritances, ...)
were all handled.
So now lets have genders, all around}
Engendering our visitor
13←EDITU(Visitor]
edit
43*p
(Isa (AnyUser AnyPerson) UserNames ("NewUser") MySlotsNowOrdered NoEntries
UsualKBs (RLL) MyCreatedAs (IExamples &) MyTimeOfCreation "18-Aug-80 13:40:23"
MyCreator "NewUser" MySensibleSlots (Descr Characteristics Prototypes AllSpecs
AllGenls AllIsas Isa OrderedPrototypes Specializations MySlots MyCreatedAs
MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots MyToRenameMe
MyToKillMe MyTimeOfCreation MyCreator UserNames --) OpenningOptions NoEntries)
43*(n Gender Male]
{ Showing my prejudices, I'll assume this visitor is masculine.
Note there is now no unit named Gender. RLL will notice that also.
}
44*ok
Verifying slots
Your attempted slot name Gender is NOT even a unit. Should it be? yes
What should the Isa link for this Gender link be? p
Please enter the Knowledge Base in which to store Gender: GENLINFO
* Initialized Gender *
edit
45*p
(Isa (PrimSlot) AllIsas (AnySlot AnyUnitListFn AnyFunction AnyCT&U Anything
AnyProcess AnyStorableFn AnyUnitFunction PrimSlot) Prototypes (TypicalPrimSlot
TypicalSlot TypicalUnitFn TypicalStorableFn TypicalFunction TypicalProcess
TypicalCT&U TypicalThing) MySlotsNowOrdered (OrderedPrototypes) MyCreatedAs (
IExamples &) MyTimeOfCreation "18-Aug-80 14:43:27" MyCreator "NewUser" Format (
*Do* FOneOf FSingleton FSet FList FOrderedSet FBag) Datatype (NonNILType)
OrderForToInit 20 --)
{ Lets fix up the value of Datatype, using our newly created one:
}
45*17 up p
... Datatype (NonNILType) OrderForToInit 20 MySensibleSlots (Descr Characteristics
Prototypes AllSpecs AllGenls AllIsas Isa OrderedPrototypes Specializations
MySlots MyCreatedAs MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots
MyToRenameMe MyToKillMe MyTimeOfCreation MyCreator WhatToProcess --))
47*(2 (GenderType]
{{48*0 p
(Isa (PrimSlot) AllIsas (AnySlot AnyUnitListFn AnyFunction AnyCT&U Anything
AnyProcess AnyStorableFn AnyUnitFunction PrimSlot) Prototypes (TypicalPrimSlot
TypicalSlot TypicalUnitFn TypicalStorableFn TypicalFunction TypicalProcess
TypicalCT&U TypicalThing) MySlotsNowOrdered (OrderedPrototypes) MyCreatedAs (
IExamples &) MyTimeOfCreation "18-Aug-80 14:43:27" MyCreator "NewUser" Format (
*Do* FOneOf FSingleton FSet FList FOrderedSet FBag) Datatype (GenderType)
OrderForToInit 20 --)}}
{ I'll also indicate that only people can have genders, using the
MakesSenseFor slot:
}
49*(n MakesSenseFor (TypicalPerson]
50*ok
Verifying slots
What should the value of Gender:Format be? FSingleton
Visitor
{ As Inverse(MakesSenseFor) is NewPossibleSlots,
Let's now look at the NewPossibleSlots of TypicalPerson
}
46←NewPossibleSlots(TypicalPerson]
(Gender Mother Husband)
Indicating that Mothers are female
{ Let's now specify that all Mothers are female:
First, how to say that range specification,
look at the UnitType datatype.
}
47←EDITU(UnitType]
edit
93*p
(VerifyType Unitp Isa (AnyDatatype) IsTypeOf (Husband UsedInCl NegLitSet
PosLitSet DerivationPath ResolventClSet ConclClSet InputClSet KBsConnectedTo
MyIsa EnvsAcrossJungles EnvsAcrossOceans MacroEnvironments LocalEnvironments
PossibleSlots SomeLiveInEnvironment Species PopulationsPresent
LivesInEnvironment --) RangeInterpreter UnitRange SuperDT (NonNILType) SubDT (
SlotType) FnForVerifyingAll NoEntry MyCreatedAs (IExamples &) AllIsas (AnyCT&U
Anything AnyDatatype))
93*f RangeInterpreter
94*p
... RangeInterpreter UnitRange SuperDT (NonNILType) SubDT (SlotType)
FnForVerifyingAll NoEntry MyCreatedAs (IExamples &) AllIsas (AnyCT&U Anything
AnyDatatype))
{ The value of DT:RangeInterpreter is a function, which uses a slot's
DataRange value to compose a function. That function is used to
restrict the values acceptable for that slot.
}
94*2 p
UnitRange
{ Lets look at this functions
}
95*ef
loading from <CSD.RLL>RLL..6
prop
edit
95*p
(LAMBDA (rangespec valname) **COMMENT** (AND & &))
95*ok
not changed, so not unsaved
UnitRange
96*ok
Nothing changed.
UnitType
{ What is the current range type of Mother?
}
48←RangeType(Mother]
[FSingleton (UnitType (*P AnyPerson)]
{ That is, the value of U:Mother is a single value, which is a unit,
which descends from AnyPerson.
Now to add that specification to Mother:
}
49←EDITU(Mother]
edit
97*f DataRange
98*2 p
(*P AnyPerson)
99*mbd (L-AND * (SlotVal Gender Female]
100*p
(L-AND (*P AnyPerson) (SlotVal Gender Female))
{ By the way, there is a unit for this L-AND
}
100*E EDITU(L-AND]
edit
100*p
(Isa (AnyLogicalOp) MyCreator "CSD.GREINER" MyTimeOfCreation "15-Apr-80 17:43:55"
MyCreatedAs (IExamples &) Defn (LAMBDA & &))
100*ok
Nothing changed.
L-AND
1*ok
Verifying slots
Mother
{ Now to show that Mother's RangeType has changed:
}
51←RangeType(Mother]
[FSingleton (UnitType (L-AND (*P AnyPerson)
(SlotVal Gender Female]
Add another person
{ Add another person to our KB
52←NewIsa(Fred AnyPerson GENLINFO]
* Initialized Fred *
edit
2*p
(Isa (AnyPerson) AllIsas (AnyCT&U Anything AnyPerson) Prototypes (TypicalPerson
TypicalCT&U TypicalThing) MySlotsNowOrdered (OrderedPrototypes) MyCreatedAs (
IExamples &) MyTimeOfCreation "18-Aug-80 15:03:25" MyCreator "NewUser"
MySensibleSlots (Descr Characteristics Prototypes AllSpecs AllGenls AllIsas Isa
OrderedPrototypes Specializations MySlots MyCreatedAs MySensibleSlots
MySlotsNowOrdered MyEssentialVirtualSlots MyToRenameMe MyToKillMe
MyTimeOfCreation MyCreator Husband --))
{ Lets engender Fred
}
2*(n Gender Male]
ok
Verifying slots
Fred
Can a male be a mother?
{ Lets see if we're allowed to make Fred a mother:
(Note PutValue returns NIL only if some error had been encountered.]
}
53←PutValue(Fred Mother Visitor]
NIL
{ That is, no value was put -- i.e.
68←UA-GETVALUE(Fred Mother]
NIL
{ [Note UA-GETVALUE is like GETPROP - no smarts]
To show PutValue can do something:
First, let's make HisMother Female:
}
69←PutValue(HisMother Gender Female]
Female
70←PutValue(Fred Mother HisMother]
HisMother
{ Proof:
}
71←UA-GETVALUE(Fred Mother]
HisMother
Now make Husbands male:
73←EDITU(Husband]
edit
19*f DataRange
20*p
... DataRange (*P AnyPerson) AllIsas (AnySlot AnyUnitListFn AnyFunction AnyCT&U
Anything AnyProcess AnyStorableFn AnyUnitFunction PrimSlot) Prototypes (
TypicalPrimSlot TypicalSlot TypicalUnitFn TypicalStorableFn TypicalFunction
TypicalProcess TypicalCT&U TypicalThing) RangeType (FSingleton &) VerifyAll (
LAMBDA & &) Inverse NoEntry KBUpdates (LAMBDA & NIL) MakesSenseFor (
TypicalPerson))
20*2 mbd (L-AND * (SlotVal Gender Male]
22*ok
Verifying slots
Husband
{ Just to check
}
75←RangeType(Husband]
[FSingleton (UnitType (L-AND (*P AnyPerson)
(SlotVal Gender Male]
To give HisMother a Husband
76←NewIsa)
Name: HerHusband
Is a IExamples of: AnyPerson
Please enter the Knowledge Base in which to store HerHusband: GENLINFO
* Initialized HerHusband *
edit
23*pp
(Isa (AnyPerson)
AllIsas
(AnyCT&U Anything AnyPerson)
Prototypes
(TypicalPerson TypicalCT&U TypicalThing)
MySlotsNowOrdered
(OrderedPrototypes)
MyCreatedAs
(IExamples (AnyPerson))
MyTimeOfCreation "18-Aug-80 15:15:50" MyCreator "NewUser" MySensibleSlots
(Descr Characteristics Prototypes AllSpecs AllGenls AllIsas Isa
OrderedPrototypes Specializations MySlots MyCreatedAs
MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots
MyToRenameMe MyToKillMe MyTimeOfCreation MyCreator Husband Mother
Gender))
{ Note Gender is on MySensibleSlots now
(of course it wasn't before it existed.]
}
23*p
23*(n Gender Male]
24*ok
Verifying slots
HerHusband
77←PutValue(HisMother Husband HerHusband]
HerHusband
Create a new type of slot - Father
78←SMARTARGLIST(CreateSlot]
(hld kb extra-pairs name)
{ To define Father
}
78←(CreateSlot '(Composition Husband Mother) 'GENLINFO NIL 'Father]
Father
{ To see if it worked:
}
79←Father(Fred]
HerHusband
{ Lets see what this unit really looks like
88←EDITU(Father]
edit
36*F Defn
37*2 pp
[LAMBDA (uNITcomp sLOTcomp oTHERcomp)
(OR (GetValue (GetValue uNITcomp (QUOTE Mother)
(AddOnCharacter oTHERcomp (QUOTE VERYSAFESLOT)))
(QUOTE Husband)
(AddOnCharacter oTHERcomp (QUOTE VERYSAFESLOT)))
NoEntry]
38*ok
Nothing changed.
Father
There is a unit for Composition:
26←EDITU(Composition]
edit
64*p
(Isa (AnySlotCombiner) Descr (Compose S1 of S2 of ... of Sn the unit)
FnForCaching NoEntry FnForUpdating (LAMBDA & &) CombinerFor (Uncle Ancestor
Charisma PossibleSlotsOfITypEx AllIsas AllExamples SuperTypEx* SubTypEx*)
HighLevelDefn NoEntries Defn (LAMBDA & & &) FnForInverting (LAMBDA & &)
RangeType (FSingleton SlotType) GetFnsUsed (LAMBDA & &) --)
64*pp
[Isa
(AnySlotCombiner)
Descr
(Compose S1 of S2 of ... of Sn the unit)
FnForCaching NoEntry FnForUpdating
[LAMBDA (affectedslt fullHLD changedslt argnames hold)
(OR [MAPCONC (REVERSE (CDR fullHLD))
(FUNCTION (LAMBDA (slt morework)
(PROG1 (COND
[(LISTP slt)
(COND
[hold (AND (SETQ morework
(UpdateASUIB
slt changedslt
(CONS (QUOTE x)
(CDR argnames))
affectedslt))
(DoToEachFn
(COND
((CDR hold)
(CONS (QUOTE Composition)
hold))
(T (CAR hold)))
changedslt argnames
(ConsN (QUOTE LAMBDA)
(QUOTE (x))
morework]
(T (UpdateASUIB slt changedslt argnames
affectedslt]
[(EQ slt changedslt)
(COND
(hold (InvalidateInverseFn
(COND
((CDR hold)
(CONS (QUOTE Composition)
hold))
(T (CAR hold)))
affectedslt changedslt argnames))
(T (InvalidateFn affectedslt changedslt
argnames]
(T NIL))
(SETQ hold (CONS slt hold]
(LIST NIL]
CombinerFor
(Uncle Ancestor Charisma PossibleSlotsOfITypEx AllIsas AllExamples
SuperTypEx* SubTypEx*)
HighLevelDefn NoEntries Defn
[LAMBDA (slotlist args)
(SETQ slotlist ([LAMBDA (**SELF**)
(APPLY* (GetValue (QUOTE Composition)
(QUOTE ToParseParts)
(QUOTE (VERYSAFESLOT VERYSAFEUNIT)))
slotlist]
NIL))
(PROG (walker answer isLIST)
(SETQ walker (REVERSE slotlist))
(SETQ answer (GetGetVal (CAR walker)
(QUOTE uNITcomp)
(QUOTE oTHERcomp)))
[SETQ isLIST (ListFormat (HardFormat (CAR walker]
LOOP(COND
((CDR walker)
(SETQ walker (CDR walker))
(SETQ answer (ComposeAux (CAR walker)
answer
(QUOTE oTHERcomp)))
(GO LOOP))
(T (RETURN (LIST [LIST (QUOTE LAMBDA)
(QUOTE (uNITcomp sLOTcomp oTHERcomp))
(LIST (QUOTE OR)
(IsOk answer)
(COND
(isLIST (QUOTE NoEntries))
(T (QUOTE NoEntry]
[CONS (COND
(isLIST (QUOTE FSet))
(T (QUOTE FSingleton)))
(CDR (RangeTypeOf (CAR slotlist]
(DomainTypeOf (CAR (LAST slotlist)))
(QUOTE PSEUDO-SLOT]
FnForInverting
[LAMBDA (hldefn temp)
(AND [EVERY (CDR hldefn)
(FUNCTION (LAMBDA (x pmet)
(AND (SETQ pmet (InvertHLD x))
(SETQ temp (CONS pmet temp]
(CONS (QUOTE Composition)
temp]
RangeType
(FSingleton SlotType)
GetFnsUsed
[LAMBDA (hld sc)
(CONS (CAR hld)
(MapUnion (CDR hld)
(FUNCTION (LAMBDA (term)
(AND (LISTP term)
(GetAllFNS term]
DefnUsedBy
(AllIsas)
GetCVsUsed
[LAMBDA (hld sc)
(OR [MapUnion (CDR hld)
(FUNCTION (LAMBDA (term)
(COND
((ATOM term)
(LIST term))
(T (GetAllCVs term]
NoEntries]
AllIsas
(AnySlotListFn AnyStorableFn AnyProcess Anything AnyCT&U AnyFunction
AnyUnitListFn AnyFunctional AnySlotCombiner)
Prototypes
(TypicalSlotCombiner TypicalSlotListFn TypicalStorableFn TypicalFunctional
TypicalFunction TypicalProcess TypicalCT&U TypicalThing)
MySlotsNowOrdered
(OrderedPrototypes)
ToParseParts
(LAMBDA (args)
(MAPCAR args (FUNCTION HLDefnParser]
64*ok
Nothing changed.
Composition
Examples of SlotCombiners
What else can we say about Father?
90←RangeType(Father]
[FSingleton (UnitType (L-AND (*P AnyPerson)
(SlotVal Gender Male]
{ Let's see if we're allowed to say "HisMother" is someone's Father
}
91←(PutValue 'Visitor 'Father 'HisMother]
NIL
Far too quite:
Isn't that annoying? It would especially even more so if we didn't know
why this function failed.
(Here, it's because Father must be Male, and "HisMother" isn't.]
Let's make it noisier -- in fact, let's create a whole new class of slots,
which are more informative.
To see how it will work, let us first see how PutValue really works:
How do accessing functions really work?
95←PP(PutValue]
loading from <CSD.RLL>UTIL..7
(PutValue
[LAMBDA (uNIT sLOT Val old why) **COMMENT** **COMMENT** **COMMENT**
(APPLY* (GetAccessFn sLOT (QUOTE ToPutValue)
(QUOTE (VERYSAFESLOT))
(QUOTE UA-DELSLOT))
uNIT sLOT Val old why])
(PutValue)
{ So you see, it basically just goes to the slot, and asks it how
put a value.
It applies the result of that GetAccessFn call on its list of arguments
}
96←PP(GetAccessFn]
loading from <CSD.RLL>RLL..6
(GetAccessFn
{{ [LAMBDA (sLOT thisslot oTHER dftfn) **COMMENT** **COMMENT**
(OR (MEMB (QUOTE IMPURE)
oTHER)
(SETQ uContext sLOT))
(SET (COND
((MEMB (QUOTE IMPURE)
oTHER)
(QUOTE uValue))
(T (QUOTE oTHER)))
(OR (IsOk (UA-GETVALUE sLOT thisslot))
(IsOk (FindDefault sLOT thisslot oTHER))
(CheckDefn (Warning (CONCAT "Unable to find the " thisslot
" slot of "
sLOT ". Perhaps it is not a unit?")))
dftfn
(QUOTE NoOp])
(GetAccessFn)}}
{ Essentially this sees if there is a value stored on sLOT:thisslot
If so, it uses that value. Otherwise, it calls FindDefault, which}
The FindDefault function:
97←PP(FindDefault]
loading from <CSD.RLL>RLL..6
(FindDefault
[LAMBDA (uUNIT uSLOT oTHERs) **COMMENT**
(AND (Slotp uSLOT)
(MapUntilOk [GetValue uUNIT (QUOTE OrderedPrototypes)
(AddOnCharacter oTHERs
(QUOTE (VERYSAFESLOT SAFE
FAST-GET
FAST-CACHE]
(FUNCTION (LAMBDA (x)
(FindValue (UA-GETVALUE x uSLOT)
x uSLOT oTHERs])
(FindDefault)
{ This looks on the unit's OrderedPrototypes, returning the first value
which is nonNIL}
98←(FindDefault 'Father 'ToPutValue]
DefaultPutValue
{ Note this is the value stored on TypicalSlot:ToPutValue}
100←EDITU(TypicalSlot]
edit
40*f ToPutValue
41*p
... ToPutValue DefaultPutValue
AfterPutValue DefaultAfterPutValue BeforePutValue DefaultBeforePutValue
DataRange NoEntry BeforeGetValue DefaultBeforeGetValue
AfterGetValue DefaultAfterGetValue
ToAddValue DefaultAddValue ToDeleteValue DefaultDeleteValue
ToKillValue DefaultKillValue --)
{ Note also BeforePutValue and AfterPutValue's values}
45*ok
Nothing changed.
TypicalSlot
Strategy:
What we must do is intercept this FindDefault
First write the function which actually prints the desired message.
Then create a whole new class of types of slots:
Each of which will be more informative
What gets done when? - system dependent fns
{ First, rewrite the appropriate function, to report Type Errors
Need to see what DefaultPutValue does:}
3←PP(DefaultPutValue]
loading from <CSD.RLL>RLL..6
(DefaultPutValue
{{ [LAMBDA (uNIT sLOT newValue oldValue why sltputter) **COMMENT**
**COMMENT** **COMMENT**
[OR why (SETQ why (LIST (QUOTE UserCommand]
(OR oldValue (SETQ oldValue (UA-GETVALUE uNIT sLOT)))
(AND (OR (MEMB (QUOTE Fast-Put)
why)
(APPLY* (GetAccessFn sLOT (QUOTE BeforePutValue))
uNIT sLOT oldValue (CONS (QUOTE NewVal)
newValue)
why))
[IsOk (SETQ sltputter (GetValue (GetValue sLOT (QUOTE Format)
(QUOTE (VERYSAFESLOT SAFE)))
(QUOTE FnForPutting)
(QUOTE (VERYSAFESLOT SAFE]
[SETQ newValue (COND
((MustComputep newValue)
(UA-DELSLOT uNIT sLOT)
RecomputeMe)
((FormattedValuep oldValue)
(APPLY* (GetValue (ValueFormat oldValue)
(QUOTE FnForPutting)
(QUOTE (VERYSAFESLOT)))
uNIT sLOT newValue oldValue why sltputter))
((FormattedValuep newValue)
(APPLY* (GetValue (ValueFormat newValue)
(QUOTE FnForPutting)
(QUOTE (VERYSAFESLOT)))
uNIT sLOT newValue oldValue why sltputter))
(T (APPLY* sltputter uNIT sLOT newValue oldValue why]
(OR (MEMB (QUOTE Fast-Put)
why)
(APPLY* (GetAccessFn sLOT (QUOTE AfterPutValue))
uNIT sLOT newValue (CONS (QUOTE OldVal)
oldValue)
why))
newValue])}}
(DefaultPutValue)
{ In effect, this first calls (GetAccessSlot slot 'BeforePutValue)
on the arguments.
If that returns nonNIL, does the put
and finally (if that also returned nonNIL)
calls (GetAccessSlot slot 'AfterPutValue) on the arguments.}
4←GetAccessSlot(Father BeforePutValue]
DefaultBeforePutValue
{ Note this appears on TypicalSlot, way above.}
5←FindDefault(Father AfterPutValue]
DefaultAfterPutValue
{ ditto}
6←PP(DefaultBeforePutValue]
loading from <CSD.RLL>RLL..6
(DefaultBeforePutValue
{{ [LAMBDA (un sl old modif why) **COMMENT**
(COND
([OR (MEMB (QUOTE UserCommand)
why)
(MEMB (QUOTE UserEdits)
why)
(AND (MEMB (QUOTE New-Unit)
why)
(NOT (EQUAL (CDR modif)
old]
(DefaultVerifyValue un sl old modif why))
(T modif])}}
(DefaultBeforePutValue)
{ Aha - DefaultVerifyValue looks like the function which attempts to verify
that a value is reasonable.
(Note it only does this if this is a user edit, ...,
as it trusts its own puts...]}
7←(DefaultVerifyValue 'Visitor 'Father NIL '(NewVal . HerHusband]
T
8←(DefaultVerifyValue 'Visitor 'Father NIL '(NewVal . HisMother]
NIL
{ Yep, that's the place. So}
Creating a new function
9←MOVD(DefaultBeforePutValue ChattyBPV T]
loading from <CSD.RLL>RLL..6
Please enter the Knowledge Base in which to store ChattyBPV: GENLINFO
"ChattyBPV defined using Interpreted Code for DefaultBeforePutValue"
{ (Note I've advised MOVD to be smart - copying the source code rather
than the compiled code;
and asking where to store this new function.
[This is a simple database management facility.]
It tolk it to store this function in the list associated
with the GENLINFO kb.}
10←EDITF(ChattyBPV]
edit
52*p
(LAMBDA (un sl old modif why) **COMMENT** (COND & &))
52*-1 2 p
((OR & & &) (DefaultVerifyValue un sl old modif why))
53*-1 p
(DefaultVerifyValue un sl old modif why)
53*mbd (OR * (PROGN (WRITELNTTY "Unable to put " (CDR modif) " onto " un
":" sl " because of a type error!!!") NIL]
55*pp
(OR (DefaultVerifyValue un sl old modif why)
(PROGN (WRITELNTTY "Unable to put " & " onto " un ":" sl
" because of a type error!!!"))
58*ok
ChattyBPV
New class of types of slots - ChattySlots
{ First, let me show you NewSpec:}
93←PP(NewSpec]
loading from <CSD.RLL>UTIL..7
(NewSpec
[LAMBDA (UNAM UOLD whichKB) **COMMENT** **COMMENT**
(NewUnit UNAM UOLD (QUOTE ISubClass)
whichKB])
(NewSpec)
{ Recall "ISubClass" was an `inheritance' unit we saw long ago.}
94←NewSpec)
Name: AnyChattySlot
Is a ISubClass of: AnySlot
Please enter the Knowledge Base in which to store AnyChattySlot: GENLINFO
* Initialized AnyChattySlot *
edit
39*p
(Isa (AnyClassOfObjects) AllIsas (AnyCT&U Anything AnyClassOfObjects) Prototypes
(TypicalClass TypicalCT&U TypicalThing) MySlotsNowOrdered (OrderedPrototypes)
MyCreatedAs (ISubClass &) MyTimeOfCreation "18-Aug-80 17:03:13" MyCreator
"NewUser" TotalSoFar 0 SuperClass (AnySlot) MySensibleSlots (Descr
Characteristics Prototypes AllSpecs AllGenls AllIsas Isa OrderedPrototypes
Specializations MySlots MyCreatedAs MySensibleSlots MySlotsNowOrdered
MyEssentialVirtualSlots MyToRenameMe MyToKillMe MyTimeOfCreation MyCreator
TotalSoFar --))
39*ok
Verifying slots
AnyChattySlot
{ Every example of AnyChattySlot will print more instructive messages
instead of just returning NIL.
This will happen because the FindDefault will stop
at TypicalChattySlot, and use the value stored there.
So now to create that unit:}
Create a new typical member of AnyChattySlot
{ Now to create the TypicalChattySlot unit, and use this new
ChattyBPV function for its BeforePutValue value}
2←NewTypEx(TypicalChattySlot AnyChattySlot GENLINFO]
* Initialized TypicalChattySlot *
edit
40*p
{{(Isa (AnyArchetype) TypicalExampleOf AnyChattySlot NewPossibleSlots NoEntries
AllIsas (AnyIntensionalObject AnyCT&U Anything AnyAT&U AnyArchetype) Prototypes
(TypicalTypicalEx TypicalCT&U TypicalAT&U TypicalThing) MySlotsNowOrdered (
OrderedPrototypes) MyCreatedAs (ITypEx &) MyTimeOfCreation "18-Aug-80 17:12:02"
MyCreator "NewUser" MySensibleSlots (Descr Characteristics Prototypes AllSpecs
AllGenls AllIsas Isa OrderedPrototypes Specializations MySlots MyCreatedAs
MySensibleSlots MySlotsNowOrdered MyEssentialVirtualSlots MyToRenameMe
MyToKillMe MyTimeOfCreation MyCreator SubTypEx* --))}}
41*(n BeforePutValue ChattyBPV]
46*ok
Verifying slots
TypicalChattySlot
{ Now all examples of AnyChattySlot will report such errors. Pf:
First, the unaltered Husband:}
11←(GetValue 'Husband 'Prototypes]
(TypicalVirtualSlot TypicalUnitFn TypicalStorableFn TypicalProcess TypicalThing
TypicalCT&U TypicalFunction TypicalSlot)
{ Note Husband's prototypes, of course, omits TypicalChattySlot}
12←(PutValue 'Visitor 'Husband 'HisMother]
NIL
{ Now move Husband over}
13←(PutValue 'Husband 'Isa '(AnyChattySlot]
(AnyChattySlot)
{ Note Husband's prototypes have been rewritten}
14←(GetValue 'Husband 'Prototypes]
(TypicalChattySlot TypicalUnitFn TypicalStorableFn TypicalProcess TypicalThing
TypicalCT&U TypicalFunction TypicalSlot)
15←redo 11
Unable to put HisMother onto Visitor:Husband because of a type error!!!
NIL
{ Ta daaa!}
16←Examples(AnyChattySlot]
(Husband)
Conclusion
{ That's about all for now.}
28←SYSOUT(DEMO]
<3SCRATCH>DEMO.EXE.1
29←LOGOUT]
It is now 18-Aug-80 17:37:40.
Closing DribbleFile <CSD.IA>TRACE.AUG18.1
@ ; Now in the monitor.